# 指定基于node:latest 这个镜像继续制作当前应用镜像
FROM alpine:3.16.2

LABEL AUTHOR="Nautilus"  VERSION=1.0.0


#ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
#    PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
#    REPO_URL=https://gitee.com/lipengguo/smzdm.git \
#    REPO_BRANCH=master

ENV REPO_URL=https://gitee.com/lipengguo/smzdm.git \
    REPO_BRANCH=master

RUN set -ex \
    && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
    && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
    && apk add --no-cache tzdata git nodejs npm  \
#    && apk add --no-cache tzdata  chromium harfbuzz ttf-freefont nss git nodejs freetype npm  freetype-dev \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo "Asia/Shanghai" > /etc/timezone \
    && apk del tzdata \
    && rm -rf /var/cache/apk/* \
    && git clone -b $REPO_BRANCH $REPO_URL /scripts \
    && cd /scripts \
    && mkdir logs \
    && npm config set registry https://registry.npm.taobao.org \
    && npm install --production \
    && cp /scripts/docker_entrypoint.sh /usr/local/bin \
    && chmod +x /usr/local/bin/docker_entrypoint.sh 



WORKDIR /scripts

ENTRYPOINT ["docker_entrypoint.sh"]

CMD [ "crond" ]